import { RouteRecordRaw } from "vue-router";

import Login from "@/views/login/index.vue";
import Layout from "@/components/layout/Layout.vue";
import Home from "@/views/home/home.vue";
import SystemRoutes from "@/router/routes/SystemRoutes"
import JobRoutes from "@/router/routes/jobRoutes"

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/login",
    name: "login",
    component: Login,
  },
  {
    path: "/main",
    name: "main",
    component: Layout,
    children: [
      {
        path: "/home",
        name: "home",
        component: Home,
        meta:{
          title: "首页"
        }
      },
      {
        path: "/system",
        name: "system",
        children: [...SystemRoutes],
        meta:{
          title: "系统管理"
        }
      },
      {
        path: "/job",
        name: "job",
        children: [...JobRoutes],
        meta:{
          title: "定时任务管理"
        }
      },
    ],
  },
  {
    path: "/",
    redirect: "/home",
  },
  
  // 404 匹配（必须放在最后）
  {
    path: '/:pathMatch(.*)*',  // 匹配所有未匹配的路径
    name: 'NotFound',
    component: (): any => import("@/components/exception/404.vue"),
  },
];
